<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>小米商城-个人中心</title>
		<link rel="stylesheet" type="text/css" href="./css/style.css">
		<script src="js/jquery-3.5.1.js" type="application/javascript"></script>
		<script src="js/js.cookie.js" type="application/javascript"></script>
		<script type="text/javascript">
			var a=null;
			$(function () {
				$.ajax({
					type: "post",
					dataType: "json",
					url: "GetLoginInfoController",
					success: function (data) {

						if (data.result != "0") {
							a=data.result;
							$("#current_user").empty();
							var str= "<ul>"
									+"<li><a href='self_info' target='_blank'>"+data.result+"</a></li>"
									+"<li>|</li>"
									+"<li><a href='shopping_cart'>我的购物车</a></li>"
									+"</ul>";
							$("#current_user").append(str);
						}  else {
							var url = "login";
							Cookies.remove('login_name');
							Cookies.remove('login_pwd');
							location.href = encodeURI(url
									+ "?tip=");
						}
					},
					error: function (XMLHttpRequest, textStatus, errorThrown) {
						// 状态码
						console.log(XMLHttpRequest.status);
						// 状态
						console.log(XMLHttpRequest.readyState);
						// 错误信息
						console.log(textStatus);
					}
				});
			});

			$(document).ready(function () {
				//获取url参数pageno
				var urlParam = window.location.search;//截取当前url中"?"后面的字符串
				urlParam = decodeURI(urlParam, "UTF-8");//可以用来把字符还原回来
				var params = urlParam.substring(urlParam.indexOf('?') + 1,
						urlParam.length);
				var param1 = params.substring(0, urlParam.indexOf('=') - 1);
				var param1Value = params.substring(urlParam.indexOf('='), urlParam.length);
				pageno = 1;
				if (param1 == "pageno") {
					pageno = param1Value;
				}
				alert("活动大酬宾，快去看看吧！");


				//动态获取用户信息列表
				$.ajax({
					type: "post",
					dataType: "json",
					url: "orderInfoListController",
					data: {
						"pageno": pageno,
						"username":a
					},
					success: function (msg) {
						//alert(msg.pageno+"  "+msg.maxpage);
						var data = msg.orderinfoList;
						if(a!=null){
							if (msg.result != "0") {
								//显示列表数据
								$("#showOrder").empty();
								var str = ""; 0
								for (i in data) {
									str +="<div class='ddxq'>"
											+"<div class='ddspt fl'><img src='./image/gwc_xiaomi6.jpg' alt=''></div>"
											+"<div class='ddbh fl'>订单号:"+data[i].orderid+"</div>"
									+"<div class='ztxx fr'>"
											+"<ul>"
											+"<li>"+data[i].isout+"</li>"
											+"<li>￥2899</li>"
									+"<li>"+data[i].riqi+"</li>"
									+"<li><a href=''>订单详情></a></li>"
									+"<div class='clear'></div>"
											+"</ul>"
											+"</div>"
											+"<div class='clear'></div>"
											+"</div>"
											+"</div>";
								}
								$("#showOrder").append(str);
								//增加分页机制
								var pagination = "<br/><br/><button  id='firstpage' type='button' value='1'  onclick='handlePaganition(this)'>首页</button>&nbsp;&nbsp;&nbsp;&nbsp;"
										+ "<button id='previouspage' type='button' value='1'  onclick='handlePaganition(this)'>上一页</button>&nbsp;&nbsp;&nbsp;&nbsp;"
										+ "<button id='nextpage' type='button' value='1'  onclick='handlePaganition(this)'>下一页</button>&nbsp;&nbsp&nbsp;&nbsp;"
										+ "<button  id='lastpage' type='button' value='1'  onclick='handlePaganition(this)'>尾页</button>&nbsp;&nbsp;&nbsp;&nbsp;";
								$("#pagination").append(pagination);
								$("#previouspage").val(msg.prePage);
								$("#nextpage").val(msg.nextPage);
								$("#lastpage").val(msg.maxPage);
							} else {
								$("#showOrder").empty();
								var str="<div>还没有任何订单哟</div>";
								$("#showOrder").append(str);
							}
						}else{
							var url = "register";
							location.href = encodeURI(url + "?tip=无用户信息，请注册");
						}
					}
				});
			});

			function handlePaganition(obj) {
				pageno = $(obj).val();
				// alert($("#pagination").html());
				var url = "order_center";
				location.href = encodeURI(url + "?pageno=" + pageno);
			}
		</script>
	</head>
	<body>
	<!-- start header -->
		<header>
			<div class="top center">
				<div class="left fl">
					<ul>
						<li><a href="index" target="_blank">小米商城</a></li>
						<li>|</li>
						<li><a href="">MIUI</a></li>
						<li>|</li>
						<li><a href="">米聊</a></li>
						<li>|</li>
						<li><a href="">游戏</a></li>
						<li>|</li>
						<li><a href="">多看阅读</a></li>
						<li>|</li>
						<li><a href="">云服务</a></li>
						<li>|</li>
						<li><a href="">金融</a></li>
						<li>|</li>
						<li><a href="">小米商城移动版</a></li>
						<li>|</li>
						<li><a href="">问题反馈</a></li>
						<li>|</li>
						<li><a href="">Select Region</a></li>
						<div class="clear"></div>
					</ul>
				</div>
				<div class="right fr">
					<div class="gouwuche fr"><a href="">我的订单</a></div>
					<div class="fr"id="current_user">
						<ul>
							<li><a href="./login.html" target="_blank">登录</a></li>
							<li>|</li>
							<li><a href="./register.html" target="_blank" >注册</a></li>
							<li>|</li>
							<li><a href="./self_info.html">个人中心</a></li>
						</ul>
					</div>
					<div class="clear"></div>
				</div>
				<div class="clear"></div>
			</div>
		</header>
	<!--end header -->
	<!-- start banner_x -->
		<div class="banner_x center">
			<a href="./index.html" target="_blank"><div class="logo fl"></div></a>
			<a href=""><div class="ad_top fl"></div></a>
			<div class="nav fl">
				<ul>
					<li><a href="">小米手机</a></li>
					<li><a href="">红米</a></li>
					<li><a href="">平板·笔记本</a></li>
					<li><a href="">电视</a></li>
					<li><a href="">盒子·影音</a></li>
					<li><a href="">路由器</a></li>
					<li><a href="">智能硬件</a></li>
					<li><a href="">服务</a></li>
					<li><a href="">社区</a></li>
				</ul>
			</div>
			<div class="search fr">
				<form action="" method="post">
					<div class="text fl">
						<input type="text" class="shuru"  placeholder="小米6&nbsp;小米MIX现货">
					</div>
					<div class="submit fl">
						<input type="submit" class="sousuo" value="搜索"/>
					</div>
					<div class="clear"></div>
				</form>
				<div class="clear"></div>
			</div>
		</div>
<!-- end banner_x -->
<!-- self_info -->
	<div class="grzxbj">
		<div class="selfinfo center">
		<div class="lfnav fl">
			<div class="ddzx">订单中心</div>
			<div class="subddzx">
				<ul>
					<li><a href="" style="color:#ff6700;font-weight:bold;">我的订单</a></li>
					<li><a href="">意外保</a></li>
					<li><a href="">团购订单</a></li>
					<li><a href="">评价晒单</a></li>
				</ul>
			</div>
			<div class="ddzx">个人中心</div>
			<div class="subddzx">
				<ul>
					<li><a href="self_info">我的个人中心</a></li>
					<li><a href="">消息通知</a></li>
					<li><a href="">优惠券</a></li>
					<li><a href="">收货地址</a></li>
				</ul>
			</div>
		</div>
		<div class="rtcont fr">
			<div class="ddzxbt" >交易订单</div>
			<div id="showOrder">
<!--				<div class="ddxq">-->
<!--					<div class="ddspt fl"><img src="./image/gwc_xiaomi6.jpg" alt=""></div>-->
<!--					<div class="ddbh fl">订单号:1705205643098724</div>-->
<!--					<div class="ztxx fr">-->
<!--						<ul>-->
<!--							<li>已发货</li>-->
<!--							<li>￥2499.00</li>-->
<!--							<li>2017/05/20 13:30</li>-->
<!--							<li><a href="">订单详情></a></li>-->
<!--							<div class="clear"></div>-->
<!--						</ul>-->
<!--					</div>-->
<!--					<div class="clear"></div>-->
<!--				</div>-->
<!--			</div>-->

		</div>
			<div id="pagination"></div>
		<div class="clear"></div>
		</div>
	</div>
<!-- self_info -->
		
		<footer class="mt20 center">			
			<div class="mt20">小米商城|MIUI|米聊|多看书城|小米路由器|视频电话|小米天猫店|小米淘宝直营店|小米网盟|小米移动|隐私政策|Select Region</div>
			<div>©mi.com 京ICP证110507号 京ICP备10046444号 京公网安备11010802020134号 京网文[2014]0059-0009号</div> 
			<div>违法和不良信息举报电话：185-0130-1238，本网站所列数据，除特殊说明，所有数据均出自我司实验室测试</div>
		</footer>
	</body>
</html>